package 草稿包;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.Scanner;

/**
 * TODO
 *
 * @Description
 * @Author Lx
 * @Date 2024/5/18 19:37
 **/
public class TEST14 {
    public static void fanzhuan(int l,int r,char[] arr){
        for(int i=l-1;i<r;i++){
            arr[i]=arr[i]=='0'?'1':'0';
        }
    }

    /** 快速输入类 */
    static class Reader {
        static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        /** 获取下一段文本 */
        static String next() throws IOException {
            in.nextToken();
            return in.sval;
        }
        /** 获取数字 */
        static int nextInt() throws IOException {
            in.nextToken();
            return (int)in.nval;
        }
        static double nextDouble() throws IOException {
            in.nextToken();
            return in.nval;
        }
    }

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int len=sc.nextInt();
        int n=sc.nextInt();
        String str =sc.next();
        if(len>str.length())len=str.length();
        char[] arr=str.toCharArray();
        while(n--!=0){
            int l,r;
            l=sc.nextInt();
            r=sc.nextInt();
            fanzhuan(l,r,arr);
        }
        System.out.println(new String(arr));
    }
}
